package April._23.work5;

import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class Main {
    public static void main(String[] args) {
        ThreadPoolExecutor threadPool = new ThreadPoolExecutor(2, 3, 60L,
                TimeUnit.SECONDS, new LinkedBlockingQueue<>(10));
        for (int i = 0; i < 10; i++) {
            threadPool.submit(new MyCallable());
        }
        // 关闭线程池
        threadPool.shutdown();
    }
}
